<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			/*
			  构造函数:构建对象的函数
			  1.函数名首字母大写
			  2.不需要return
			  3.使用this指定属性和行为
			  
			  this代表当前对象
			*/
			function Person(name, age) {
				this.name = name;
				this.age = age;
				this.work = function() {
					console.log("工作");
				}
			}

			var p1 = new Person("张三", 20);
			console.log(p1.name);

			var p2 = new Person("李四", 30);
		</script>
	</body>
</html>
